#include "comm.h"
#include <stdlib.h>
#include <unistd.h>

int main()
{
  key_t key = ftok(PATH_NAME, PROJ_ID);
  if(key < 0)
  {
    perror("key");
    exit(1);
  }

  int shmid = shmget(key, SIZE, IPC_CREAT);
  if(shmid < 0)
  {
    perror("key");
    exit(2);
  }

  char* ret = (char*)shmat(shmid, NULL, 0);
  const char* str = "abcdefghij";
  
  int cnt = 0;
  int len = 10;
  while(len--)
  {
    ret[cnt] = str[cnt];
    cnt++;
    ret[cnt] = 0;
    sleep(1);
  }

  shmdt(ret);

  return 0;
}
